package com.wxx.controller;

import net.sf.cglib.reflect.FastClass;
import net.sf.cglib.reflect.FastMethod;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wxx.service.IfastClass;
import com.wxx.utils.SpringContextUtil;

@Controller
public class ExperimentController {

	@Autowired
	private SpringContextUtil sc;
	
	@Autowired
	private IfastClass ifc;

	@RequestMapping(value = "/experiment", method = RequestMethod.POST)
	@ResponseBody
	public String experiment() {
		ApplicationContext ac = sc.getApplicationContext();
		int beanNum = ac.getBeanDefinitionCount();
		String name = ac.getApplicationName();
		String iud = ac.getId();
		String name2 = ac.getDisplayName();
		FastClass fastMethod = ifc.get("cache1");
		return ac.containsBean("cache1") == true ? "ok" : "no";
	}
}
